package com.gupt.youhd;/*
@author name
@data 2023/4/8-23:58
*/


import com.gupt.youhd.mapper.UserMapper;
import com.gupt.youhd.entity.User;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@RestController
public class Temp {

    @Autowired
    UserMapper userMapper;


    @GetMapping("/retrieve")
    public List<User> test() {
        List<User> users = userMapper.retrieveAllUser();
        return users;
    }

    @Test
    public void test2() {  //测试校验方法
        int A[] = {2, 3, 1};
        int[] array = new int[A.length];

        Arrays.sort(A);

        int i = Arrays.binarySearch(A, 2);
        System.out.println(i);
        if (i < 0) {
            System.out.println("无注册该学校");
        }
        if (i > 0) {
            System.out.println("欢迎");
        }

        for(int j = 0;j < A.length;j++){
          array[j] = A[j];
        }
        System.out.println(Arrays.toString(array));
    }

    @Test
    public void test3(){
        List list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        System.out.println(list);
    }

    @Test
    public void test4(){
        String s = "13499648723";
        Integer integer = Integer.valueOf(s);
        int i = Integer.parseInt(s);
        System.out.println(i);
    }

    @Test
    public void test5(){
        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        System.out.println(list);

        String[] a = new String[3];
        a[1] = "a";
        a[2] = "a";
        a[0] = "a";
        for (String s : a) {
            System.out.println(s);
        }
    }
}
